import { ApiProperty } from '@nestjs/swagger'
import { ModelOptions, prop, Ref } from '@typegoose/typegoose'
import { Episode } from './episode.model'

@ModelOptions({
    schemaOptions: {
        timestamps: true
    }
})
export class Course {
    @ApiProperty({ description: '课程名称' }) // 接口文档
    @prop()
    name: string

    @ApiProperty({ description: '封面图' })
    @prop()
    cover: string

    @ApiProperty({ description: '课时列表' })
    @prop({ ref: 'Episode' })
    episodes: Ref<Episode>[]
}
